//
//  AnimationTimingBoot.swift
//  SwiftUIWidgetDemo
//
//  Created by alanzhangg on 2023/7/14.
//

import SwiftUI

struct AnimationTimingBoot: View {
    
    @State var isAnimation: Bool = false
    let timing: TimeInterval = 10.0
    
    var body: some View {
        VStack{
            Button("Button") {
                isAnimation.toggle()
            }
            
            RoundedRectangle(cornerRadius: 25.0)
                .frame(width: isAnimation ? 350 : 50, height: 100)
                .animation(.spring(response: 0.5, dampingFraction: 0.7, blendDuration: 1.0), value: isAnimation)
//                .animation(.spring(), value: isAnimation)
//                .animation(.linear(duration: timing), value: isAnimation)
            
//            RoundedRectangle(cornerRadius: 25.0)
//                .frame(width: isAnimation ? 350 : 50, height: 100)
//                .animation(.easeIn(duration: timing), value: isAnimation)
//            
//            RoundedRectangle(cornerRadius: 25.0)
//                .frame(width: isAnimation ? 350 : 50, height: 100)
//                .animation(.easeInOut(duration: timing), value: isAnimation)
//            
//            RoundedRectangle(cornerRadius: 25.0)
//                .frame(width: isAnimation ? 350 : 50, height: 100)
//                .animation(.easeOut(duration: timing), value: isAnimation)
            
            
            
        }
    }
}

#Preview {
    AnimationTimingBoot()
}
